package com.demo.mapper;


import com.demo.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapperAnno {
    @Select("select * from users where uid=#{id}")
    User findById(int id);

    @Select("select * from users")
    List<User> findAll();

    @Insert("insert into users(uname,uage) values(#{uname},#{uage})")
    @Options(useGeneratedKeys = true, keyColumn = "uid", keyProperty = "uid")
    int add(User user);

    @Update("update users set uname=#{uname},uage=#{uage} where uid=#{uid}")
    int update(User user);

    @Delete("delete from users where uid=#{id}")
    int delete(int id);
}
